//对外暴露配置路由(常量路由):全部用户都可以访问到的路由
export const constantRoute = [
    // 登录
    {
        path: '/login',
        component: () => import('@/views/login/index.vue'),
        name: 'Login',
        meta: {
            title: '登录', //菜单标题
            hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
            icon: 'Promotion', //菜单文字左侧的图标,支持element-plus全部图标
        },
    },
    // 登录成功以后展示数据的路由
    {
        path: '/',
        component: () => import('@/layout/index.vue'),
        name: 'Index',
        meta: {
            title: '',
            hidden: true,
            icon: '',
        },
        redirect: '/home',
        children: [
            {
                path: '/home',
                component: () => import('@/views/home/index.vue'),
                name: 'Home',
                meta: {
                    title: '首页',
                    hidden: false,
                    icon: 'HomeFilled',
                }
            },
        ]
    },
    {
        path: '/screen',
        component: () => import('@/views/screen/index.vue'),
        name: 'Screen',
        meta: {
            hidden: false,
            title: '数据大屏',
            icon: 'Platform',
        },
    },
    // TODO: 以下路由需要根据权限动态生成
    {
        path: '/acl',
        component: () => import('@/layout/index.vue'),
        name: 'Acl',
        meta: {
            hidden: false,
            title: '权限管理',
            icon: 'Lock',
        },
        redirect: '/acl/user',
        children: [
            {
                path: '/acl/user',
                component: () => import('@/views/acl/user/admin/index.vue'),
                name: 'User',
                meta: {
                    hidden: false,
                    title: '人员管理',
                    icon: 'User',
                },
                // redirect: '/acl/user/admin',
                // children: [
                //     {
                //         path: '/acl/user/admin',
                //         component: () => import('@/views/acl/user/admin/index.vue'),
                //         name: 'UserAdmin',
                //         meta: {
                //             title: '管理员',
                //             hidden: false,
                //             icon: 'Avatar',
                //         }
                //     },
                //     {
                //         path: '/acl/user/student',
                //         component: () => import('@/views/acl/user/student/index.vue'),
                //         name: 'UserStudent',
                //         meta: {
                //             title: '学生',
                //             hidden: false,
                //             icon: 'UserFilled',
                //         }
                //     },
                // ]
            },
            {
                path: '/acl/role',
                component: () => import('@/views/acl/role/index.vue'),
                name: 'Role',
                meta: {
                    hidden: false,
                    title: '角色管理',
                    icon: 'Postcard',
                },
            },
            // {
            //     path: '/acl/permission',
            //     component: () => import('@/views/acl/permission/index.vue'),
            //     name: 'Permission',
            //     meta: {
            //         hidden: false,
            //         title: '菜单管理',
            //         icon: 'Menu',
            //     },
            // },
        ],
    },
    {
        path: '/book',
        component: () => import('@/layout/index.vue'),
        name: 'Book',
        meta: {
            hidden: false,
            title: '图书管理',
            icon: 'Memo',
        },
        redirect: '/book/info',
        children: [
            {
                path: '/book/info',
                component: () => import('@/views/book/info/index.vue'),
                name: 'Info',
                meta: {
                    hidden: false,
                    title: '图书信息',
                    icon: 'Tickets',
                },
            },
            {
                path: '/book/inventory',
                component: () => import('@/views/book/inventory/index.vue'),
                name: 'Inventory',
                meta: {
                    hidden: false,
                    title: '库存管理',
                    icon: 'ShoppingCartFull',
                },
                redirect: '/book/inventory/add',
                children: [
                    {
                        path: '/book/inventory/add',
                        component: () => import('@/views/book/inventory/add/index.vue'),
                        name: 'AddInventory',
                        meta: {
                            hidden: false,
                            title: '新建入库',
                            icon: 'FolderAdd',
                        },
                    },
                    {
                        path: '/book/inventory/update',
                        component: () => import('@/views/book/inventory/update/index.vue'),
                        name: 'UpdateInventory',
                        meta: {
                            hidden: false,
                            title: '信息更新',
                            icon: 'Edit',
                        },
                    }
                ]
            },
            {
                path: '/book/status',
                component: () => import('@/views/book/status/index.vue'),
                name: 'Status',
                meta: {
                    hidden: false,
                    title: '状态管理',
                    icon: 'Reading',
                },
            },
        ],
    },
]

export const errorRoute = [
    // error
    {
        path: '/404',
        component: () => import('@/views/error/404.vue'),
        name: '404',
        meta: {
            title: '404',
            hidden: true,
            icon: 'DocumentDelete',
        },
    },
]

//异步路由
export const asyncRoute = [
    // 登录
    {
        path: '/login',
        component: () => import('@/views/login/index.vue'),
        name: 'Login',
        meta: {
            title: '登录', //菜单标题
            hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
            icon: 'Promotion', //菜单文字左侧的图标,支持element-plus全部图标
        },
    },
    // 登录成功以后展示数据的路由
    {
        path: '/',
        component: () => import('@/layout/index.vue'),
        name: 'Index',
        meta: {
            title: '',
            hidden: true,
            icon: '',
        },
        redirect: '/home',
        children: [
            {
                path: '/home',
                component: () => import('@/views/home/index.vue'),
                name: 'Home',
                meta: {
                    title: '首页',
                    hidden: false,
                    icon: 'HomeFilled',
                }
            },
        ]
    },
    {
        path: '/screen',
        component: () => import('@/views/screen/index.vue'),
        name: 'Screen',
        meta: {
            hidden: false,
            title: '数据大屏',
            icon: 'Platform',
        },
    },
    {
        path: '/student/book',
        component: () => import('@/layout/index.vue'),
        name: 'StudentBook',
        meta: {
            title: '',
            hidden: true,
            icon: '',
        },
        redirect: '/book/borrow',
        children: [
            {
                path: '/book/borrow',
                component: () => import('@/views/book/borrow/index.vue'),
                name: 'BookBorrow',
                meta: {
                    title: '借阅管理',
                    hidden: false,
                    icon: 'Collection',
                }
            },
        ]
    },
    {
        path: '/student/status',
        component: () => import('@/layout/index.vue'),
        name: 'StudentStatus',
        meta: {
            title: '',
            hidden: true,
            icon: '',
        },
        redirect: '/book/borrow/status',
        children: [
            {
                path: '/book/borrow/status',
                component: () => import('@/views/book/borrow/status.vue'),
                name: 'BookBorrowStatus',
                meta: {
                    title: '借阅状态',
                    hidden: false,
                    icon: 'Reading',
                }
            },
        ]
    }
]

//任意路由
export const anyRoute = {
    //任意路由
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    name: 'Any',
    meta: {
        title: '任意路由',
        hidden: true,
        icon: 'DataLine',
    },
}
